   <link rel="stylesheet" type="text/css" href="../addons/jy_sendgoods/resource/css/style.css">
    <link rel="stylesheet" type="text/css" href="../addons/jy_sendgoods/resource/css/bargain.css?v=20181212">
<style>
    .fui-cell-group{width:100%;}
    .fullback-title{color:#999999;font-size:0.7rem;padding:0.75rem 0 0.5rem 0;}
    .fullback-info{}
    .fullback-info p{height:1rem;line-height: 1rem;font-size:0.625rem;color:#333;display: inline-block;padding:0 0.5rem 0 0;}
    .fullback-info p i{border:none;height:0.75rem;width:0.75rem;display: inline-block;background: #ff4753;color:#fff;font-size:0.4rem;line-height: 0.8rem;text-align: center;
        font-style: normal;border-radius: 0.75rem;-webkit-border-radius: 0.75rem;margin-right:0.25rem;}
    .fullback-remark{line-height: 1rem;font-size:0.6rem;color:#666;padding:0.2rem 0;}

</style>
<div class='fui-page fui-page-current'>
        <div class='fui-content'>
           <!--轮播图-->
			<div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true">
				<div class="carousel-inner" role="listbox" style="height:13rem">
					<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.goods.images">
						<a href="#">
							<img src="{{tomedia(item) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
						</a>
					</div>
				</div>
				<style>
					.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
					.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
				</style>
				<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
						<div class="fui-swipe-bullet" ng-repeat="item in pagedata.goods.images" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
				</div>
			</div>
            <div class="lynn_goods_head">
                <div class="lynn-goods-head-top fui-list">
                   
                    <div class="fui-list-inner">
                        现价：&yen;<strong>{{pagedata.goods.price}}</strong> 原价:<del>&yen;{{pagedata.goods.originalprice}}</del>
                    </div>

                   
                    <div class="fui-list-media">
                        <i>{{pagedata.orders.count || '暂无'}}人购买</i>
                    </div>
                </div>
                <div class="lynn-goods-head-title fui-list">
                    <div class="fui-list-inner">
                        <h2>{{pagedata.goods.title}}</h2>
                        <p>{{pagedata.goods.title}}</p>
                        <p>库存：{{pagedata.goods.total}}</p>
                    </div>

                    <div class="fui-list-media">
				
                        <a onclick="$('#showsystemcontent').modal();" style="color:f60" data-nocache="true"><i class="icon jinyunicon icon-manageorder"></i><p>规则</p></a>
                    </div>
                </div>
           </div>
		<div class="fui-cell-group  fui-sale-group">
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:auto">已选</div>
				<div class="fui-cell-info bold" style="color:#333">
					{{pagedata.selespename}}{{pagedata.num}}件
				</div>
				<div class="fui-cell-remark noremark" onclick="$('#showspec').modal();" ng-click=""><i class="icon jinyunicon icon-icon-test"></i></div>
			</div>
			<div class="detail-info content content-images">

                    <div class="detail-info-title"><span></span></div>
						
                  
              </div>
		</div>
		<!--商品详情已完成-->
		<div class="detail-block" style="position: relative;margin-top:0.5rem;border-radius: 0.5rem;width:100%;background:#fff;padding-bottom:0">
				<div class="fui-cell-text bold" style="padding:0.5rem">活动详情</div>
				<div class="content-block content-images" ng-bind-html="trust(pagedata.goods.content)"></div>
		</div>
    </div>
        <div class="fui-navbar footer-nav bordert" style="z-index:10;padding:0;">
            <a ng-click="access_json('jy_sendgoods/index/')"  class="nav-item home-btn" data-nocache="true">
                <span class="icon jinyunicon icon-shouye"></span>
                <span class="label">首页</span>
            </a>
			<a ng-click="access_json('jy_sendgoods/home/')" class="nav-item home-btn">
                <span class="icon jinyunicon icon-wo1"></span>
                <span class="label">我的</span>
            </a>
            <a ng-if="pagedata.status==1" ng-click="pagedata.check();" class="nav-item btn buybtn">立即购买</a>
            <a ng-if="pagedata.status==0" class="nav-item btn buybtn disabled"><span style="color: #ccc">尚未开始</span></a>
            <a ng-if="pagedata.status==3" class="nav-item btn buybtn disabled"><span style="color: #ccc">已经结束</span></a>
            <a ng-if="pagedata.status==4" class="nav-item btn buybtn disabled"><span style="color: #ccc">库存不足</span></a>
            
        </div>
</div>
<div id="showsystemcontent" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:96%;left:2%;top:1.5%;">
<div class="modal-content" style="min-height:500px">
	<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="right:10px;top:0"><i class="icon jinyunicon icon-wrong" style="color:#ccc;"></i></div>
	<div class="fui-article-page">
			<div class="fui-article-title" style="text-align:center">优品送礼规则</div>
			<div class="fui-article-content" ng-bind-html="trust(pagedata.set.rule)"></div>
	</div>
</div>
</div>
</div>
<div id="showspec" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:100%;left:0;bottom:0">
<div class="modal-content">
    <div class="option-picker ">
	<div class="option-picker-inner">
	<div class="option-picker-cell goodinfo">
	    <div class="closebtn"><i class="icon icon-guanbi1"></i></div>
	    <div class="img"><img class='thumb' src="{{tomedia(pagedata.act.goods.image)}}" /></div>
	    <div class="info info-price text-danger">
			<span>
				￥
				<span class='price' style="font-weight:600">
				{{pagedata.goods.price}}
				</span>
			</span>
		</div>
	    <div class="info info-total">
	    	库存 <span class='total'>{{pagedata.goods.total}}</span> 件
	    </div>
	<div class="info info-titles" ng-if="pagedata.specs.length>0">请选择规格</div>
	</div>
	<div class="option-picker-options">
		<div ng-repeat="(k,spec) in pagedata.specs_list" class="option-picker-cell option spec">
		<div class="title">{{spec.title}}</div>
		<div class="select">
		     <a ng-repeat="item in spec.items" href="javascript:;" ng-click="pagedata.get_optionsid();pagedata.post.specid[k]=item.id;pagedata.post.ggg=item.id;" ng-class="{'btn btn-default btn-sm nav spec-item':1,'btn-select':pagedata.post.specid[k]==item.id}"> {{item.title}} </a>
		</div>
	    </div>
		<div class="fui-cell-group noborder" style="margin-top:0">
			<div class="fui-cell noborder">
			<div class="fui-cell-label">数量</div>
			<div class="fui-cell-info"></div>
			<div class="fui-cell-mask noremark">
				 <div class="fui-number">
					<div class="minus" ng-click="pagedata.minus()">-</div>
					<input class="num" type="tel" name="" value="{{pagedata.num}}"/>
					<div class="plus" ng-click="pagedata.plus()">+</div>
				</div>
			</div>
			</div>
		</div>
	</div>
	<div class="fui-navbar">
	    <a href="javascript:;" aria-hidden="true" data-dismiss="modal" class="nav-item btn confirmbtn">确定</a>
	</div>
    </div>
    </div>

</div>
</div>
</div>
<script type="text/javascript">

require(['bootstrap', 'hammer'], function($, Hammer){
	$('#carousel-container').carousel();
	var mc = new Hammer($('#carousel-container').get(0));
	mc.on("panleft", function(ev) {
		$('#carousel-container').carousel('next');
	});
	mc.on("panright", function(ev) {
		$('#carousel-container').carousel('prev');
	});
});
scope.pagedata.minus=function(){
	if(scope.pagedata.num <=1){
		return false;
	}
	scope.pagedata.num--;
	scope.$evalAsync();
}
//增加
scope.pagedata.plus=function(){

	scope.pagedata.num++;
	//限购
	if(scope.pagedata.num > scope.pagedata.act.goods.total){
		scope.message('您的最大购买数量：'+scope.pagedata.act.goods.total,'error');
		scope.pagedata.num--;
	}
	scope.$evalAsync();
}

scope.pagedata.get_optionsid=function(){
	var specid = scope.pagedata.post.specid;
		specid = specid.join('_');
	var params={
		data:{'specid':specid},
		op:'get_optionsid',
		callback:function(res){
			scope.pagedata.post.optionsid=res.options.id;
			scope.pagedata.options=res.options;
			scope.pagedata.selespename=res.selespename;
			if(res.options.id){
				scope.pagedata.goods.price=res.options.price;
			}
			scope.$evalAsync();
		}
	};
	scope.post_json(params);
}
scope.pagedata.check=function(){
	var specid = scope.pagedata.post.specid;
	specid = specid.join('_');
	var params={
		data:{'actid':scope.pagedata.act.id,'num':scope.pagedata.num,'specid':specid,'price':scope.pagedata.goods.price},
		op:'check',
		callback:function(res){

					//	if(res.type==1){
							scope.message('','','jy_sendgoods/create//actid='+res.actid+'&specid='+res.specid+'&price='+res.price+'&num='+res.num);
							
					//	}
					//	else{
							//scope.message('您还有该商品订单等待支付!','error','jy_sendgoods/order//status=0');
					//	}
				
				
		
		}
	};
	scope.post_json(params);

}
</script>
